Sorry for the huge text, but I did not find a better way to explain it without hiding some problems.
I have a table with two columns (ID and Text(actually richtext as it can contain tables and -possibly- OLES)). Each row is a different element with a unique ID and some text. This text related to each ID may change in the future. So I want to be able to search for ID's between brackets in an Object Text, substitute it's ID for its text, so now I have the text between brackets. I want to be able to revert this operation in a future session (this is better explained later on). In case I have the text related to some ID between brackets, I want to be able to check if this text has changed related to its ID and it case it did change, I want to update it with it's updated text.
This is how I was doing it: 1 - I search all object texts from a module for these ID's which will always be between brackets. 2 - When I find a bracket with an ID from this table, I substitute the content between the brackets(ID) for its respective text(richText) in the table. When I do this I am able to remember where this ID was, so that I can revert this operation if I want (revert the Text to its respective table ID) in a later session. In order to do this I thought of using RichText "\v" and "\v0" which allow me to hide and unhide text. So I hide the ID with "\v[ID]\v0" and insert its respective text(richText) with brackets right before the hidden ID.
So what I do is search for brackets:
This script was working perfectly, but I recently figured that when someone writes the Object Text, it can happen that some ID strings get embedded with richText garbage -> Say the ID was ID_07574 it's richText in the Object Text can be "\lang0583_\lang0584907574" so when I search for the ID from the Table which does not have richText gargabe(because I just read it as normal text from the table), I can never find it.
Any suggestions on how to solve this? Maybe there is another option for using "\v\v0" or some way to mix the text with richText in a smart way.
camba - Mon Oct 10 12:15:30 EDT 2016 |
Re: Mix RichText with string I think it might not proove very stable to do text modifications like this. After all somebody might always destroy your hidden IDs when editing the text. Would it be maybe a solution to provide a DXL attribute for the users, that would subsititute the texts? - In this case you would never have to hide the ID in the original Object Text in the first place. - Users would also be forced to change the replacement text in the table (since they cannot edit the subsituted text inside DXL attribute). - Users can edit the normal object text or the table and changes will be reflected in the DXL attribute "immediately" (without the user having to run a script). There have also been ways to replicate the style of the main column in an attribute DXL. If a DXL attribute is no option for you, I would suggest using an RTF parser to really sort out all the mean stuff, that richtext can throw at you. I posted one here once: And I think I might have one with a little better control (more low level, allows you to write a special parser more easily). If you are interested ping back here. Regards, Mathias
|
Re: Mix RichText with string Mathias Mamsch - Tue Oct 11 03:55:35 EDT 2016 I think it might not proove very stable to do text modifications like this. After all somebody might always destroy your hidden IDs when editing the text. Would it be maybe a solution to provide a DXL attribute for the users, that would subsititute the texts? - In this case you would never have to hide the ID in the original Object Text in the first place. - Users would also be forced to change the replacement text in the table (since they cannot edit the subsituted text inside DXL attribute). - Users can edit the normal object text or the table and changes will be reflected in the DXL attribute "immediately" (without the user having to run a script). There have also been ways to replicate the style of the main column in an attribute DXL. If a DXL attribute is no option for you, I would suggest using an RTF parser to really sort out all the mean stuff, that richtext can throw at you. I posted one here once: And I think I might have one with a little better control (more low level, allows you to write a special parser more easily). If you are interested ping back here. Regards, Mathias
Thank you for the response, Mathias.
I am indeed interested in the lower level version.
Kind Regards, Bruno |
Re: Mix RichText with string camba - Fri Oct 14 08:43:45 EDT 2016 Thank you for the response, Mathias.
I am indeed interested in the lower level version.
Kind Regards, Bruno Currently I have no access to the code. I will post it in 2 weeks. Regards, Mathias |